If else function works, automatic compile implemented