(fix) re-organizing code for easier legibility