Added some improvements to business logic.