Improve readability of js code