working advanced version, no balance