buggy and hacky, but the shiz works :)