Refactoring, cleaning up, adding more documentation, etc