Ported library functions into jQuery plugin