Lots of changes made when implementing kameja.lv project. I'm much too lazy to sort through and separate into individual commits :(