precommand merged from tkoess