Seemingly fixed Javascript functionality. Still room for improvement and polish however.