moved code around since it miscalculated due to orhan blocks