Formatted and moved js into other file