docs,fixing: adding doc strings, fixing logical errors and amending tests