Moved apply to separate file