All functions implemented and tested