some script optimisations and findings (loads db info every time, script running makes it a little slow)