Almost done refactor of code structure to add prototype methods