Main logic was added.