Modified so that theres no outer function