implemented latest changes from diagram