Code cleanup and tiny bit more documentation