Added the snippet feature & cleaned JS