Added some functionality for corner cases.