Incorporate more of Przer's code