File manager - start of code cleanup ($messages), see notes
Code clean-up ($emessage to $mes)