Updated commentary and cleaned code