Most implementation, quick and dirty version.