Code splitted on different libs.

Some GUI issues fixed.