Lots of refactoring to save memory
Merge pull request #133 from littlemousy/main

Lots of refactoring to save memory