Some debbuging and enhancement