Moved inline js into methods