Edited main, fixed some errors