Cleanup code, add docs
Refactor code, add insertAt convenience function