Added more comments, cleaned up code.