Improvements. Needs to fix some logic.