Currently working but may not work in all cases