code refactor & add phone call listener