Trying to organize the code