Some minor fixes, indent, functions order, comments