Refactor and functionality added.