clean up logic
fix docblocks