Partialize js files, minor optimizations