Minor code improvements + more docs