updating docs, cleaning up code