converting tabs to spaces and cleaning up code