massive refactor to make a desktop version possible