Updated functionality and javascript