Changed code blocks to javascript