Restructure code and update examples