Added tests for layers, fixed some problems on the way. In particular changed some things in the way SLDs are added when uploaded, may break some things. We really need to figure out that part better.