Code cleanup and documentation in README