Unified functions

Thanks @Howaner!