Finished work on basic functionality. Begin refactoring.