[Update]: cleaned code after added JSHint.