Code commented and cleaned up