Fixed a bug with ruling
resolves #6
resolves #5
resolves #7