reworked logic to limit image size (both kb and pixels) for faster storage/upload. Various cleanup