moving pseudocode to exceptions