Prettified the code somewhat