Added extra functions and tests