Commented, optimized, fixed small errors etc.