Adding logic for collecting energy. still buggy.