Improved views performance by removing database queries where possible