Resource management basics

Also fixed resizing issues