Separate core function