added expand code, need to manage energy next