less shitty cubic function