Added else if

I added else if statement with while statement to validate.. also
started on the function