Some more documentation + code cleanup