Added User Input and refined if then logic