added rotate90 and moved allocation check code from imitate() to allocate()