Concept2.m added with working code

Still slow and needs optimizing