Same features as previous commit with minor bug fixes.
Same features as previous commit with minor bug fixes.