we might be able to refactor this (hopefully)