Passes all tests and basic implementation

Needs cleaning