Added datastructures, refactored timer and helpers, added states.