Implemented everything - still needs bugfixing