added more comments and explicit parameters for solve