misc functions used in the game