refactor how modules work, generate schemas