Updated code and added examples