move drawtype to a different function