Modified layers to use contexts. Fixed socket syntax errors.