reformat
added multigame support, cleaned up unused code