Make js object orientated

Makes life a bit easier.