uploaded Bryan's code