Changed structure to avoid head overflow