works fine for most cases