completely redesigned; handling any prefix type