Added -m option, moved cleanup to extra function, added cleanup as action