Refactored javascript and css code out of spa.html