Refactored agent code
Removed stale migrations