clean up old code
fix relations