swapped minified for dev version
refactored to significantly remove memory leaks