Reordered functions for better readability
Reordered functions for better readability