Clean up code and add auto scroll to top

success and error callbacks should be on their own line for easy identification