[lib] Remove unused and unneeded code