Added the core functionality

Still very buggy