hacky but somewhat working