tweak to am pm logic