tidy up source code