Implementing feature #19, fixed some issues.