throw exception if before command not found; adjust code style