WIP: add better error handling and enablefirst rotation control