add autorotate option

stolen from the @phillipoertel fork :) thanks