Fixed formatting issues
Removed repeated functions