fixed define function, cleaned