Simplified some stuff and added example