fixed @param types, made some vars protected, etc.