Trying to organize code