Removed superfluous function (moved logic back to original function).