updated to handle rmate