main simple logic