Changed function execution to remove redundancy 

Credits to /u/hamlahamla for spotting bug.