Adding more comments and moving code to and easier to see place