added a bit of polish and code cleanup