adding option to automatically resize and fixing some other stuff