Moved all JS into an external script