Main Logic added