Changed tabs to spaces and other code formatting