finish brick.object.js and rearrange code