Working according to spec, can be merged after review in master