implemented pattern delete
code clean up