Working version
Refactors
Compile-bug fix