latest version, cleaned up