Fixed tests and reimplemented missing functions on Repository