Added some documentation strings, reformatted code layout