expert code cleaned