Rehook right click menu items for the layers.

Also make the code a little less stupid.