significant code refactor to OOP, see README for detailed updates.