tried to modularize, failed