Update #5

Basic code is ready. Need testing.