Removed doomed code, replaced function with a more suitable codes