reduce and clarify code