Fixed some errors and reformatted