moving build logic into guard