Modified Token code and added functionality