Categories

Categories loaded from db
bunch of bugfixes if array was empty or array did not contain exactly
three elements