A very basic javascript version