Updated and Debugged