Added endbuild in right spot