refactored autobuild