Refactored Main

Same code for player, autoplayer and logger!