beautified the code a bit