WIP: cleaning up, switching from methods to functions for relevant parts