Simplifying functions; adding minified version