Modifying functions for better modularity and elasticity