more formatting and added doc comments