Fixed bug in active_player calculation + other cleanups.