cleaned up code and docs