Fixed types, some bugs, etc.