Fixing issue #4 preliminary design, further improvements as new bugs.