Sorted input properly now