Major refactor I ~ comments and minor changes