moved if statement