Added updated code and did some renaming