trying to organize code better