categories mechanisms added
added some validation
mistake fixed
let's hope that this is the final version