Made javascript bit better by comments and remove unneccessary things.