updated some pseudo code