Small bug fix along with some little refactoring to remove some object details leak.