Added function to count free tiles

minor changes