Added all core functionality, ironed out most bugs