added docs, refactor