created desing pattern for js oop. not working now