writing testing function