More code refractoring, new features, many major fixes and improvements