polish code a bit