Rewrite in progress
temp
Working version