Moved some js into it's own file