Cleaning up, adding documentation