added if-else to build blocks