Moved if testing to separate file