refactored nineplate a bit. Added some jsdoc