completed compute implementation