fixing issues with linked properties and cleaning up code