Made minor modifications to code.