Migrated some methods from assignment3