all functions working and tested