Adding basic working version - more generalizations required