updated to an object oriented javascript, but not completely done implementing