Use object prototype

I think this is more "proper" javascript