Cleaned up code. Added const.