rearranging functions for readability