Previous version was not working due to separation of js and html