was in the middle of adding new data structures, but the single file was becoming a bit heavy - refactoring code into a proper library now.