Implemented code for retaining tools