modified for variable pointer height