old code cleaned