Seperated out pixmap handling into it's own function.