Finished most of the core functionality