kinda works, but i might refactor