Organized code into packages and fixed pause state persistence