trying to modularize this like a real programmer