code cleaned-up