code simplification & formatting