Code commented and cleaned