add main logic functions