functions tested and working