Added documentation, cleaned up files, fixed bugs