started to write main function code (based on assumption of starting position)