some further refinement, more comments and array methods, functions for binary representation