more efficient implementation and other features