better peripheral finding function
removed local for now, but that is something that should be fixed
better os_terminate