added minified version (and fixed some bugs)