Updated code

Some code added and some old code removed!