Nice function, but this can be fine tuned.