Version with bugs fixed