Merged changes from Kuuko and myself