Refactored class code to javascript files

:pouting_cat: :gun: