Tested function solved