Improvements on the code.