Using classes instead of just plain javascript