Cleaned up social grid code