update arrays and refactor lecture