updated build logic