contract fixes and cleanup