major refacor, much easier to read now
updated to current game state