Trying to separate front-end from back-end.
Rearranging functions.