Cleanup, reorganize and minify