Changes before Dan's refactoring