Took care of some edge cases