Cleaned up Stagr's code