Moved graphics layer creation.
Added jsdoc comments.