minor modifications added for handling white spaces