Implemented almost everything