Cleaned Javascript code