Remove needless functions and inline them