Improve documentation, get rid of reverse, optimize