Refactor code

Use model method "keys_list" for constructing an array of keys for logs. Use one-line if appropriate to improve readability.