Added almost full functionality, fixed dumb bug