Improved code a bit.