Updated main, fixed small bugs