Moved generate_layers to where it can access modules correctly
Fixed syntax error