cleaned function and struct