Updated with some fixes