Specification for repository model + some fixes