Add corrected getTophat code