Added if tests, fixed wrong function names.