Implemented most functionality. TODO lists whats left.